<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright (c) 2013 - 2017 Boundless - http://boundlessgeo.com All rights reserved.
  This code is licensed under the GPL 2.0 license, available at the root
  application directory.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd


    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd"
       default-autowire="byName">


    <bean id="imageResourceController" class="org.geoserver.gsr.model.controller.ImageResourceController">
        <constructor-arg ref="geoServer" />
    </bean>

    <mvc:resources mapping="/gsr-demos/**" location="classpath:/demos/"/>

    <!-- <mvc:annotation-driven/> -->
    <context:component-scan base-package="org.geoserver.gsr.api" />
    <context:component-scan base-package="org.geoserver.gsr.translate.relationship" />
    <bean id="geoServer" class="org.geoserver.config.impl.GeoServerImpl"/>
    <!-- The GRS dispatcher (same as OGC API dispatcher for the moment, but allows for customization/subclassing later -->
    <bean id="gsrDispatcher" class="org.geoserver.gsr.GSRDispatcher">
        <constructor-arg ref="geoServer"/>
    </bean>
    <bean id="gsrExceptionHandler" class="org.geoserver.gsr.GSRExceptionHandler"/>

    <bean id="gsrServiceFactory" class="org.geoserver.ogcapi.APIServiceFactoryBean">
        <constructor-arg index="0" value="GSR"/>
        <constructor-arg index="1" value="10.51"/>
    </bean>

    <!-- api http url mapping -->
    <bean id="gsrURLMapping" class="org.geoserver.ows.OWSHandlerMapping">
        <constructor-arg ref="catalog"/>
        <property name="alwaysUseFullPath" value="true"/>
        <property name="useTrailingSlashMatch" value="true"/>
        <property name="order" value="0"/>
    
        <property name="mappings">
            <props>
                <prop key="/gsr">gsrDispatcher</prop>
                <prop key="/gsr/**">gsrDispatcher</prop>
            </props>
        </property>
    </bean>
    
    
</beans>
